﻿/******************************************************************************
 * Copyright 2020-xxxx xxx Co., Ltd.
 * All right reserved. See COPYRIGHT for detailed Information.
 *
 * @projectName   aaa
 * @file          xstaticchart.h
 * @brief         Class XStaticChart
 *
 * @author        Feng<2859352492@qq.com>
 * @date          2022/03/09 10:54:57
 * @history
 *****************************************************************************/

#ifndef XSTATICCHART_H
#define XSTATICCHART_H

#include <QObject>
#include "objlib.h"
#include "basedata.h"
#include "qcustomplot.h"
#include "xnamespace.h"
#include "xcustompointlines.h"
#include "xcustombars.h"

#include <QDebug>

QT_BEGIN_NAMESPACE

using namespace xvs;

class XStaticChartPrivate;
class XStaticChart : public QCustomPlot
{
    Q_OBJECT

    Q_PROPERTY(Array xArray READ getXArray WRITE setXArray)
    Q_PROPERTY(Array xRangeArray READ getXRangeArray WRITE setXRangeArray)
    Q_PROPERTY(Array yRangeArray READ getYRangeArray WRITE setYRangeArray)
    Q_PROPERTY(ChartTickLabelType tickLabelType READ getTickLabelType WRITE setTickLabelType)

public:
    explicit XStaticChart(QWidget *parent = nullptr);
    ~XStaticChart();

    /* Property Interface */
    Array getXArray() const;
    void setXArray(Array &array);                       //Array内需为Integer/Real

    Array getXRangeArray() const;
    void setXRangeArray(Array &array);                  //Array内需为Integer/Real

    Array getYRangeArray() const;
    void setYRangeArray(Array &array);                  //Array内需为Integer/Real

    ChartTickLabelType getTickLabelType() const;
    void setTickLabelType(ChartTickLabelType type);

    /* Other Interface */
    void setTickLabel(Array &array);                    //Array内需为String

    /* Object Control */
    XCustomBars *barCharts = nullptr;
    XCustomPointLines *pointLineCharts = nullptr;

protected:
    void setupChart();
    void setupAxis();

private:
    Q_DISABLE_COPY(XStaticChart)
    XStaticChartPrivate *XStaticChartP = nullptr;
};

QT_END_NAMESPACE

#endif // XSTATICCHART_H
